define(['TV'], function (TV) {
    TV.focus(function (e) {
        console.log(e)
    })

    var KEY_UP = 0x0026,
        KEY_DOWN = 0x0028,
        KEY_LEFT = 0x0025,
        KEY_RIGHT = 0x0027,
        KEY_ENTER = 0x000d;
    document.onkeydown = function (event) {
        switch (event.which) {
            case KEY_UP:
                console.log('上');
                TV.emit({type: 'key.up'});
                break;
            case KEY_DOWN:
                console.log('下');
                TV.emit({type: 'key.down'});
                break;
            case KEY_LEFT:
                console.log('左');
                TV.emit({type: 'key.left'});
                break;
            case KEY_RIGHT:
                console.log('右');
                TV.emit({type: 'key.right'});
                break;
            case KEY_ENTER:
                console.log('确认');
                TV.emit('key.enter');
                break;
        }
    };
    document.onkeypress = function (event) {

    };
    document.onkeyup = function (event) {

    };

    return this;
});